#ifndef __THREADPOOL_H__
#define __THREADPOOL_H__
#include <iostream>
#include <thread>
#include "TaskQueue.h"
#include <vector>

using std::thread;
using std::vector;

using Task = function<void()>;
class ThreadPool
{
public:
    ThreadPool(size_t threadNum, size_t _queSize);
    ~ThreadPool();
    void start();
    void stop();
    void addTask(Task &&taskcb);

private:
    Task getTask();
    void doTask();

    size_t _threadNum;
    vector<thread> _threads;
    size_t _queSize;
    TaskQueue _taskQue;
    bool _isExit;
};


#endif

